<?PHP

// ref: http://www.pastebin.ca/611218
if (!function_exists('json_encode')){ 
//now its portable to php ver. < 5.2.0 where you would otherwise have to install the php-json c-extension first
    include_once('Services_JSON.php');
    $json = new Services_JSON();
    function json_encode($value){
        global $json;
        return $json->encode($value);
    }
    function json_decode($value){
        global $json;
        return $json->decode($value);
    }
}

$_array1[] = array(
	'product' => 'WRT Internals',
	'price' => 24.5,
	'quantity' => 1
	);
$_array2[] = array(
	'product' => 'The Prototype world',
	'price' => 5.44,
	'quantity' => 3
	);
$_array3[] = array(
	'product' => 'WRK Reference',
	'price' => 10.00,
	'quantity' => 4
	);
	
header('Content-type: application/x-json');
$data = array($_array1, $_array2, $_array3);
//encode and return json data...
echo json_encode($data); 

?>
